package com.xjl.controller;

import com.xjl.utils.redis.RedisUtil;
import com.xjl.threadlocal.RequestHander;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by xiaojinlu1990@163.com on 2019/11/25.
 */
@RestController
@RequestMapping("/threadLocal")
public class Test {
    @Autowired
    private RedisUtil redisUtil;
    @RequestMapping("/test")
    @ResponseBody
    public String getStr(){
        return "111";
    }
    @RequestMapping("/redis")
    @ResponseBody
    public String getStr1(){
        redisUtil.set("111","3");
        redisUtil.get("111");
        return (String) redisUtil.get("111");
    }


    @RequestMapping("/filter")
    @ResponseBody
    public String thread(){
        RequestHander.getId();
        redisUtil.set("111","3");
        redisUtil.get("111");
          RequestHander.getId();
        return (String) redisUtil.get("111");
    }
}
